package com.wg.springboot.controller;

import com.wg.springboot.model.Student;
import com.wg.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping(value = "/update")//参数带了默认的都可以省略
    @ResponseBody
    public Object update(Integer id,String name){
        Student student = new Student();
        student.setId(id);
        student.setName(name);
        int count=studentService.updateStudentById(student);
        return "修改学生"+id+"的姓名的修改结果"+count;
    }
}
